<?php
class Application_Model_Form_Login extends Zend_Form{
	
	function __construct($options=null){
		parent::__construct($options);
		$log = new Zend_Form_Element_Text('login');
		$log->setRequired(TRUE)
			->setAttrib('type', 'email') 
			->addFilter('StripTags')
			->addFilter('StringTrim')
			->addValidator('NotEmpty')
			->addValidator(new Zend_Validate_EmailAddress())
			->setAttrib('placeholder', 'E-mail')
			->addValidator(new Zend_Validate_EmailAddress())
			->setDecorators(array(
					'ViewHelper',
					'Errors',
					array(array('data' => 'HtmlTag'), array('tag' => 'td')),
					));
		 
		$pass = new Zend_Form_Element_Password('password');
		$pass->setRequired(TRUE)
			->addFilter('StripTags')
			->addFilter('StringTrim')
			->setAttrib('placeholder', 'Пароль')
			->addValidator('NotEmpty')
			->setDecorators(array(
				'ViewHelper',
				'Errors',
				array(array('data' => 'HtmlTag'), array('tag' => 'td')),
			));
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton')
				->setLabel('Войти')
				->setDecorators(array(
					'ViewHelper',
					'Errors',
					array(array('data' => 'HtmlTag'), array('tag' => 'td')),
				));
		
		$this->addElements(array($log,$pass, $submit))
				->setAction('/auth/login')
				->setMethod('post')
				->setView(new Zend_View)
				->clearDecorators()
				->setDecorators(array(
					'FormElements',
					array('HtmlTag', array('tag' => 'table', 'class'=>'login_form')),
					array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
					'Form',
				));
	}
}